
import React, { Component,Suspense } from 'react';
import { Route,Switch,Redirect } from 'react-router-dom';

import '../styles/Index.scss'
import Tabbar from '../components/Tabbar';
import Home from './Index/Home';
import Cate from './Index/Cate'
import Goodcar from './Index/Goodcar'
import My from './Index/My'
import NotFound from '../views/NotFound'
class Index extends Component {
    render() {
        return (
    <div className='index'>
          <Suspense fallback={<div className='loading'>< img src="https://hbimg.b0.upaiyun.com/5ac0d375bfb83e892b4884bb1d7e5046d223da2d2bd08-LrjhBO_fw658" alt="" /></div>}>
              <Switch>
                <Route path="/index/home" component={Home} />
                <Route path="/index/cate" component={Cate} />
                <Route path="/index/goodcar" component={Goodcar} />
                <Route path="/index/personalcenter" component={My} />
                <Redirect exact from='/index' to="/index/home" /> //路由重定向
                <Route path="*" component={NotFound} /> //404路由
               </Switch>
            </Suspense>
               <div className="tabBar">
                   <Tabbar/>
               </div>
          </div>
        );
      }    
}

export default Index;